package Iterator;
public class BookIterator implements Iterator {
    private Book book;
    private Integer index;
    public BookIterator(Book book) {
        this.book = book;
        this.index = 0;
    }
    @Override
    public boolean hasNext() {
        if (index < book.getPageNum()) {
            return true;
        } else {
            return false;
        }
    }
    @Override
    public Object next() {
        BookPage bookPage = book.getPageAt(index);
        index++;
        return bookPage;
    }
}
